/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package quanlysieuthi;

import DAO.*;
import DTO.*;
import com.oracle.jrockit.jfr.ContentType;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.sql.Timestamp;
public class CTest {    
    
    public static void TestNhanVien(){
        List<CNhanVien> list = new ArrayList<CNhanVien>();
        CNhanVien nv ;
        nv = new CNhanVien();
        nv.setChuc_VuId(1);
        nv.setDiaChi("32 nguyen minh khai ");
        nv.setDienThoai("0951245");
        nv.setGioiTinh(true);
        nv.setHoTen("quang phuc");
        Date d = new Date();
        nv.setUserId(1);
        Timestamp t = new Timestamp(d.getYear(), d.getMonth(), d.getDay(), d.getHours(), d.getMinutes(), d.getSeconds(), 0);
        nv.setNgaySinh(t);
        list.add(nv);
        SubConfig config = SubConfig.getInstance();
        config.init();
        CNhanVienDAO nvDao = new CNhanVienDAO();
        nvDao.addrows(list, config);
        config.close();
    }
    public static void TestSanPham(){
        List<CSanPham> list = new ArrayList<CSanPham>();
        CSanPham sp ;
        sp = new CSanPham();
        sp.setTenSanPham("ghe nhua");
        sp.setGiaNhap(1000.0);
        sp.setNguoiSua("");
        sp.setSoLgTonToiDa(100);
        sp.setTonToiThieu(1);
        sp.setDonGia(1500.0);
        list.add(sp);
        
        sp = new CSanPham();
        sp.setTenSanPham("tu kinh");
        sp.setGiaNhap(1000.0);
        sp.setNguoiSua("");
        sp.setSoLgTonToiDa(100);
        sp.setTonToiThieu(1);
        sp.setDonGia(1500.0);
        list.add(sp);
        
        sp = new CSanPham();
        sp.setTenSanPham("Ban ui");
        sp.setGiaNhap(1000.0);
        sp.setNguoiSua("");
        sp.setSoLgTonToiDa(100);
        sp.setTonToiThieu(1);
        sp.setDonGia(1500.0);
        list.add(sp);
        
        SubConfig config = SubConfig.getInstance();
        config.init();
        CSanPhamDAO spDao = new CSanPhamDAO();
        spDao.addrows(list, config);
        config.close();
    }
    
    public static void TestChiTietHoaDon(){
        List<CChiTietHoaDon> list = new ArrayList<CChiTietHoaDon>();
        CChiTietHoaDon cthd;
        cthd = new CChiTietHoaDon();
        cthd.setDonVi("cai");
        cthd.setDongia(1200.0);
        cthd.setGiamGia(0.0);
        cthd.setHoaDonId(1);
        cthd.setId(1);
        cthd.setSanPhamId(1);
        cthd.setSoLuong(2);
        cthd.setTang(false);
        cthd.setTenSanPham("chieuc ghe ngoi");
        cthd.setThanhTien(2400.0);
        cthd.setTienTra(2400.0);
        list.add(cthd);
        
        cthd = new CChiTietHoaDon();
        cthd.setDonVi("cai");
        cthd.setDongia(1200.0);
        cthd.setGiamGia(0.0);
        cthd.setHoaDonId(1);
        cthd.setId(1);
        cthd.setSanPhamId(1);
        cthd.setSoLuong(2);
        cthd.setTang(false);
        cthd.setTenSanPham("chieuc ghe ngoi");
        cthd.setThanhTien(2400.0);
        cthd.setTienTra(2400.0);
        list.add(cthd);
        cthd = new CChiTietHoaDon();
        cthd.setDonVi("cai");
        cthd.setDongia(1200.0);
        cthd.setGiamGia(0.0);
        cthd.setHoaDonId(1);
        cthd.setId(1);
        cthd.setSanPhamId(1);
        cthd.setSoLuong(2);
        cthd.setTang(false);
        cthd.setTenSanPham("chieuc ghe ngoi");
        cthd.setThanhTien(2400.0);
        cthd.setTienTra(2400.0);
        list.add(cthd);
        cthd = new CChiTietHoaDon();
        cthd.setDonVi("cai");
        cthd.setDongia(1200.0);
        cthd.setGiamGia(0.0);
        cthd.setHoaDonId(1);
        cthd.setId(1);
        cthd.setSanPhamId(1);
        cthd.setSoLuong(2);
        cthd.setTang(false);
        cthd.setTenSanPham("chieuc ghe ngoi");
        cthd.setThanhTien(2400.0);
        cthd.setTienTra(2400.0);
        list.add(cthd);
        CChiTietHoaDonDAO cthddao = new CChiTietHoaDonDAO();
        SubConfig config = SubConfig.getInstance();
        config.init();
        cthddao.addrows(list, config);
        config.close();
    }
    public static void TestKhacHang(){
        List<CKhachHang>list = new ArrayList<CKhachHang>();
        
        CKhachHang khHang ;
        khHang = new CKhachHang();
        khHang.setDiaChi("nguyen van cu");
        khHang.setDienThoai("0123546");
        khHang.setFax("");
        khHang.setHoTen("cong ty co phan");
        khHang.setId(1);
        khHang.setLoai(1);
        khHang.setNhomKhId(1);
        list.add(khHang);
        
        khHang = new CKhachHang();
        khHang.setDiaChi("11 Lac Long Quan");
        khHang.setDienThoai("097658421");
        khHang.setFax("");
        khHang.setHoTen("Pham Quang Quynh");
        khHang.setId(1);
        khHang.setLoai(1);
        khHang.setNhomKhId(1);
        list.add(khHang);
        
        khHang = new CKhachHang();
        khHang.setDiaChi("15 tran hung dao");
        khHang.setDienThoai("095124142");
        khHang.setFax("");
        khHang.setHoTen("Nguyen Minh Khang");
        khHang.setId(1);
        khHang.setLoai(2);
        khHang.setNhomKhId(1);
        list.add(khHang);
        
        SubConfig config = SubConfig.getInstance();
        config.init();
        CKhacHangDAO khdao = new CKhacHangDAO();
        khdao.addrows(list, config);
    }
}
